import { http } from '@/utils/request.js'

// 登录接口
export const loginService = (userCode, userPwd) => {
	return http({
		url: '/tbUser/login',
		method: 'POST',
		data: {
			userCode,
			userPwd
		},
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}

// 获取用户基本信息
export const profileService = () => {
	return http({
		url: '/tbUser/profile',
		method: 'GET'
	})
}

// 申请选课
export const addTask = (data) => {
	return http({
		url: '/task/add',
		method: 'POST',
		data: data
	})
}

// 修改个人信息
export const updateProfileService = (data) => {
	return http({
		url: '/tbUser/update',
		method: 'PUT',
		data: data
	})
}

// 修改密码
export const updatePwdService = (oldPassword, password) => {
	return http({
		url: '/tbUser/updatePwd',
		method: 'PUT',
		data: {
			oldPassword,
			password
		},
		header: {
			'content-type': 'application/x-www-form-urlencoded'
		}
	})
}